<?php

/**
 * Controller.php
 */
class Controller extends CController {

    public $breadcrumbs = array();
    public $menu = array();
    public $description;
    public $keywords;

    /**
     * The first, system will run this function.
     * @param INT $id
     * @param string $module
     */
    public function __construct($id, $module = null) {
	parent::__construct($id, $module);

	//neu user da dang nhap thi ca nhat lai thoi gian login
	if (!user()->isGuest) {
	    //cap nhat thoi gian
	    db()->createCommand()
		    ->update('{{users}}', array(
			'last_online' => CURR_TIME
			    ), 'user_id = :id', array(
			':id' => user()->id
	    ));
	}

	cs()->registerCoreScript('jquery');
    }

    /**
     * function run after layout loaded
     * @param type $view
     * @param type $output
     */
    public function afterRender($view, &$output) {

	Yii::app()->clientScript->registerMetaTag($this->description, 'description');
	Yii::app()->clientScript->registerMetaTag($this->keywords, 'keywords');
    }

}
